package com.jcl.recruit.channel.dao;

import com.jcl.recruit.channel.mapper.ChannelNetMapper;
import com.jcl.recruit.channel.model.ChannelNet;
import com.jcl.core.db.DatabaseContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Component
public class ChannelNetDao implements ChannelNetMapper {

    @Autowired
    private ChannelNetMapper channelNetMapper;

    @Override
    public List<ChannelNet> findList(String corpCode,
                                     String account,
                                     String channelType,
                                     Integer status) {
        DatabaseContext.setContext(corpCode);
        return channelNetMapper.findList(corpCode, account, channelType, status);
    }

    @Override
    public List<ChannelNet> selectList(String corpCode, String userId) {
        DatabaseContext.setContext(corpCode);
        return channelNetMapper.selectList(corpCode, userId);
    }

    @Override
    public ChannelNet findOneByAccountNo(String corpCode, String accountNo) {
        DatabaseContext.setContext(corpCode);
        return channelNetMapper.findOneByAccountNo(corpCode, accountNo);
    }

    @Override
    public ChannelNet findOne(String corpCode, Integer id) {
        DatabaseContext.setContext(corpCode);
        return channelNetMapper.findOne(corpCode, id);
    }

    @Override
    public int addChannelNet(ChannelNet channelNet) {
        DatabaseContext.setContext(channelNet.getCorpCode());
        return channelNetMapper.addChannelNet(channelNet);
    }

    @Override
    public int updateChannelNet(ChannelNet channelNet) {
        DatabaseContext.setContext(channelNet.getCorpCode());
        return channelNetMapper.updateChannelNet(channelNet);
    }

    @Override
    public int deleteChannelNet(String corpCode, Integer id, Integer status) {
        DatabaseContext.setContext(corpCode);
        return channelNetMapper.deleteChannelNet(corpCode, id, status);
    }


}
